<!DOCTYPE html>
<!--该页面为一阶段紧急使用功能，已废除-->
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<body>
<form id="form" role="form" method="post" th:action="${action}">
    <div class="row">
        <div class="col-md-12">
            <div class="form-group" th:each="feature,index:${features}">
                <input type="hidden" th:name="${feature.getpCfg0ObjectId()}" id="pModelPuid"
                       th:value="${feature.getPuid()}"/>
                <label th:text="${feature.getpCfg0FamilyDesc()}+'-'+${feature.getpCfg0Desc()}+'&emsp;&emsp;'+${feature.getpCfg0FamilyName()+'-'+feature.getpCfg0ObjectId()}"></label>
                <select class="form-control input-small" data-style="btn-info" th:name="'s'+${index.index}">
                    <option th:each="line:${lines}" th:value="${line.getPuid()}" th:text="${line.getLineID()}"></option>
                </select>
            </div>
        </div>
    </div>
</form>

<script th:inline="javascript">
    <![CDATA[
    $(function () {
        // 绑定dialog的确定按钮的监听事件
        $("#btnOk", window.top.document).click(function () {
            var url = $("#form", window.top.document).attr('action');
            var projectPuid = $("#project", window.top.document).val();
            <!--其实不要puid，puid会在服务器上生成-->
            var data = {};
            data.projectPuid = projectPuid;
            var _d = $("#form").serializeArray();
            for (var p in _d) {
                if(_d.hasOwnProperty(p)){
                    data[_d[p].name] = _d[p].value;
                }
            }
            $.ajax({
                contentType:
                    "application/json",
                type:
                    'POST',
                url: url,
                data: JSON.stringify(data),
                success:
                    function (result) {
                        // $('.modal-dialog', window.top.document).parent('div').remove();
                        // $('body', window.top.document).find('.modal-backdrop').remove();
                        activeTabBodyReset();
                        window.Ewin.alert({message: result.msg});
                    },
                error: function (status) {
                    window.Ewin.alert({message: status.status + ':添加数据失败!'});
                }
            });
        });
    })
    ]]>
</script>
</body>
</html>